

/*package com.example.GeoCoder;

import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

import org.apache.http.HttpEntity;
import org.apache.http.HttpRequestFactory;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.google.android.maps.GeoPoint;

import android.app.Activity;
import android.app.ListActivity;
import android.location.Address;
import android.location.Geocoder;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.RatingBar;
import android.widget.TextView;

public class GeoCoderActivity extends ListActivity {

	/*double LATITUDE = 37.42233;
	double LONGITUDE = -122.083;
	static TextView myLatitude;
	String KEY = "AIzaSyDzCR523KK9HS6_iKvKqbsTyJ1JP4-BeUM";
	/*String jobj;
	GeoPoint gp;
	/** Called when the activity is first created. 
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		//setContentView(R.layout.main);
		//myLatitude = (TextView) findViewById(R.id.mylatitude);
		//TextView myAddress = (TextView) findViewById(R.id.myaddress);
	    String address = "-33.8670522,151.1957362";
		String radius= "500";
		String types="food";
		String name = "harbour";
		String sensor = "false";
		
		JSONObject json = getLocationInfo(address,radius,types,name,sensor,KEY);
		ArrayAdapter<Location> adapter = new MyListAdapter(this,getList(json));
		setListAdapter(adapter);
	}

	private List<Location> getList(JSONObject json) {
		// TODO Auto-generated method stub
        try {
        	JSONArray results = json.getJSONArray("results");
        	List<Location> list = new ArrayList<Location>();
        	for(int i= 0; i < results.length(); i++) {
        	Location loc= new Location(results.getJSONObject(i));
        	list.add(loc);
        	}
        	
        	return list;
        } catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		return null;
	}



	public static JSONObject getLocationInfo(String location,String radius, String types, String name, String sensor,String key) {
		final String PLACES_AUTOCOMPLETE_URL = "https://maps.googleapis.com/maps/api/place/autocomplete/json?";
		//HttpGet httpGet = new HttpGet("http://maps.googleapis.com/maps/api/geocode/json?address="+address+"ka&sensor=false");
		HttpGet httpGet = new HttpGet("https://maps.googleapis.com/maps/api/place/search/json?location="+location+"&radius="+radius+"&types="+types+"&name="+name+"&sensor="+sensor+"&key=AIzaSyDzCR523KK9HS6_iKvKqbsTyJ1JP4-BeUM");
		
		
		HttpClient client = new DefaultHttpClient();

		   
		HttpResponse response;
		StringBuilder stringBuilder = new StringBuilder();

		try {
			response = client.execute(httpGet);
			
			HttpEntity entity = response.getEntity();
			InputStream stream = entity.getContent();
			int b;
			while ((b = stream.read()) != -1) {
				stringBuilder.append((char) b);
			}
		} catch (ClientProtocolException e) {
		} catch (IOException e) {
		}

		JSONObject jsonObject = new JSONObject();
		try {
			jsonObject = new JSONObject(stringBuilder.toString());
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		return jsonObject;
	}
}
	/*public static GeoPoint getGeoPoint(JSONObject jsonObject) {

		Double lon = new Double(0);
		Double lat = new Double(0);

		try {

			lon = ((JSONArray) jsonObject.get("results")).getJSONObject(0)
					.getJSONObject("geometry").getJSONObject("location")
					.getDouble("lng");

			lat = ((JSONArray) jsonObject.get("results")).getJSONObject(0)
					.getJSONObject("geometry").getJSONObject("location")
					.getDouble("lat");

		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		return new GeoPoint((int) (lat * 1E6), (int) (lon * 1E6));
**********************************************************************
*float f;
		try {
			f = Float.parseFloat(jsonLocation.getString("rating"));
		
		String s="";
    	s=jsonLocation.getString("types")+jsonLocation.getString("rating")
    		+jsonLocation.getString("name")+
    		jsonLocation.getString("vicinity");
    	 ratingbar.setRating(f);
    	 myLatitude.setText("Latitude: " + s);
	}
	
	*******************************************************
	*LocationObject loc1= new LocationObject(results.getJSONObject(0));
        	list.add(loc1);
        	LocationObject loc2= new LocationObject(results.getJSONObject(0));
        	list.add(loc2);
	*System.out.println("hello1");
        	JSONArray results = json.getJSONArray("results");
        	System.out.println("hello2");
        	addressTextView = (TextView) findViewById(R.id.myaddress);
        	addressTextView.setText( "hithere");
        	
        	venueTextView = (TextView) findViewById(R.id.venueTextview);
        	
        	String s = results.getJSONObject(0).getString("name");
        	System.out.println(s);
        	addressTextView.setText(s);
	*
	*
	*/
	


